import { defineStore } from 'pinia'
import {
    allAccountTypeList,
    allCompanyList
} from '@/api/system/fund/config.js'

const useConfigStore = defineStore(
    'company', {
        state: () => ({
            companyList: [],
            accountTypeList: [],
        }),
        actions: {
            getCompanyList() {
                return new Promise((resolve, reject) => {
                    allCompanyList().then(resp => {
                        this.companyList = resp.data
                        resolve(resp)
                    }).catch(err => [
                        reject(err)
                    ])
                })

            },
            getAccountTypeList() {
                return new Promise((resolve, reject) => {
                    allAccountTypeList().then(resp => {
                        this.accountTypeList = resp.data
                        resolve(resp)
                    }).catch(err => {
                        reject(err)
                    })
                })
            },

        }
    })

export default useConfigStore